﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QuanLyBanHang.OBJECT;
using System.Data.SqlClient;

namespace QuanLyBanHang.DAL
{
    static class DalKhoHang
    {
        public static DataTable LoadWareHouse()
        {
            string sql = "select * from KhoHang";
            DataTable dt = DataHelper.Load(sql);
            return dt;
        }

        public static int Insert(ObjKhoHang obj)
        {
            SqlParameter[] para = new SqlParameter[1];
            para[0] = new SqlParameter("TenKho", obj.Ten);
            int thucthi = DataHelper.Update(para, "spInsertKhoHang");
            return thucthi;
        }
        public static int Update(ObjKhoHang obj)
        {
            SqlParameter[] para = new SqlParameter[2];
            para[0] = new SqlParameter("MaKho", obj.Ma);
            para[1] = new SqlParameter("TenKho", obj.Ten);
            int thucthi = DataHelper.Update(para, "spUpdateKhoHang");
            return thucthi;
        }
    }

}
